home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
afloat.zip
/
README
< prev
Wrap
Text File
|
1988-03-16
|
3KB
|
57 lines
FLOATING-POINT LIBRARY PROJECT
By Bob Kline
Copyright Bob Kline 1988
This package contains routines for single-precision floating-
point math routines. Two parallel libraries are included -- one for use
with 808x assembly-language programs, the other for use in C programs
written for the IBM PC family and friends and compiled with a C compiler
which uses the standard Microsoft small memory model naming and
parameter conventions (such as Microsoft C or Borland's Turbo C). The
first set of routines passes parameters directly in registers, and the
second passes parameters on the stack. Each library has its own .DOC
file and a header file. Source code, as well as the separately
assembled object modules are provided on the disk. Note that there are
three object modules included in the C library which are not directly
accessible to the C code in a user's program, as they receive their
paramters directly in registers: FDECTOBIN, FBINTODEC, and LDIV10. The
documentation and source code for these modules are included in the
materials for the assembly-language library. A compiler (such as the
Turbo C compiler) which provides the programmer with the tools for
direct access to the registers (either via in-line assembly or the
"pseudo-variables," such as _AX, _BX) would make it possible to call
these procedures directly from the C code.
Three versions of a sample program are provided to give a very
rough idea of how to call the functions from C or assembler. The first
version is in C, and uses the traditional statements for manipulating
floating-point values and variables. The program prompts for a
floating-point number and adds .0001 to it 10000 times, reports the
result, as well as the amount of time taken to perform the operations.
The second version is also in C, but uses the functions from the new
library. The third is in assembly-language, and uses the assembly-
language version of the new library. Version 2 is more than 5 times
faster than the first, and the assembly-language version is even a
little faster than the second version, although the difference is not
nearly as dramatic. Note that in version 2 I have also experimented
with avoiding the use of the run-time library altogether, calling
functions from a user-supplied library. In addition, I pared down the
usual start-up and exit code normally linked in with a C program. The
result is an executable program which is more than 10 times smaller than
the first version, and for some reason even a little smaller than the
assembly-language version would have been if I had done the assembly as
a .COM file (the incentive for which is greatly reduced by the
convenience of using the new .MODEL directives of MASM 5.0, which do not
support the so-called 'TINY' model needed to convert to the older .COM
style).
The package was produced as a final project for Ernie Philipps'
excellent class in micro-assembler programming, taught at the Alexandria
campus of the Northern Virginia Community College. Although only the
lowest-level operations were built into this version of the packages, I
hope that this start will provide the impetus for later students,
perhaps as a team project, to build on this beginning by adding some of
the fancier stuff, such as geometric or exponential functions. Good
luck!